//禁止右键
window.onload = function(){
  document.onkeydown = function (){
    var e = window.event || arguments[0];
    /*延迟，兼容FF浏览器  */
    if(e.keyCode== 83 && e.ctrlKey){
      return false;
    }else if(e.keyCode == 123){
      //F12
      return false;
      //Ctrl+Shift+I
    }else if((e.ctrlKey) && (e.shiftKey) && (e.keyCode == 73)){
      return false;
      //Shift+F10
    }else if((e.shiftKey) && (e.keyCode == 121)){
      return false;
      //Ctrl+U
    }else if((e.ctrlKey) && (e.keyCode == 85)){
      return false;
    }
  };
}
window.document.oncontextmenu = function (){
  return false;
}
//微信内访问
function is_weixin()
{
  var ua = window.navigator.userAgent.toLowerCase();
  if (ua.match(/MicroMessenger/i) == 'micromessenger')
  {
    return true;
  }else{
    return false;
  }
}
//身份证验证
function isidcard(idcard)
{
  var reg = /(^\d{15}$)|(^\d{17}(\d|X)$)/;
  if(reg.test(idcard))
  {
    return true;
  }else{
    return false;
  }
}
//邮箱验证
function isemail(email)
{
  var reg = /^([a-zA-Z]|[0-9])(\w|\-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/;
  if(reg.test(email))
  {
    return true;
  }else{
    return false;
  }

}

var sleep = function(time) {
  var startTime = new Date().getTime() + parseInt(time, 10);
  while(new Date().getTime() < startTime) {}
};
